package com.yidu.t299.service.xp.impl;
import com.yidu.t299.dao.xp.SedulousManageMapper;
import com.yidu.t299.domain.xp.Lesson;
import com.yidu.t299.domain.xp.SedulousManage;
import com.yidu.t299.domain.xp.StudentManage;
import com.yidu.t299.service.xp.SedulousManageBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;

/**
 * @descripion:
 * @auth: XuPan
 * @date: 2023/3/8 19:54
 * @version: 1.0
 */
@Service
@Transactional
public class SedulousManageBizImpl implements SedulousManageBiz {
    @Autowired
    private SedulousManageMapper sedulousManageMapper;//注入数据


    @Override
    public int deleteByPrimaryKey(Integer sedId) {
        return sedulousManageMapper.deleteByPrimaryKey(sedId);
    }

    @Override
    public int insert(SedulousManage record) {
        return sedulousManageMapper.insert(record);
    }

    @Override
    public SedulousManage selectByPrimaryKey(Integer sedId) {
        return sedulousManageMapper.selectByPrimaryKey(sedId);
    }

    @Override
    public List<SedulousManage> selectByPage(int rows, int page, String condition) {
        return sedulousManageMapper.selectByPage(rows, page, condition);
    }

    @Override
    public int selectCount(String condition) {
        return sedulousManageMapper.selectCount(condition);
    }

    @Override
    public int updateByPrimaryKey(SedulousManage record) {
        return sedulousManageMapper.updateByPrimaryKey(record);
    }

    @Override
    public String getCondition(SedulousManage sedulousManage) {
        // 定义条件字符串变量，初始值为空格字符串
        String condition = " ";
        //如果出勤对象为空则直接返回条件字符串
        if (sedulousManage == null){
            return condition;
        }
        if (sedulousManage.getStudentName() != null && sedulousManage.getStudentName().trim().length()!=0){
            condition += " and student_name like '%" + sedulousManage.getStudentName() + "%'";
        }
        //返回条件字符串
        return condition;
    }

    @Override
    public List<StudentManage> selectAllGetStudent() {
        return sedulousManageMapper.selectAllGetStudent();
    }

    @Override
    public List<Lesson> selectAllGetlessonName() {
        return sedulousManageMapper.selectAllGetlessonName();
    }


    @Override
    public int selectByStudentName(String studentName) {
        return sedulousManageMapper.selectByStudentName(studentName);
    }

    @Override
    public int selectByLessonName(String lessonName) {
        return sedulousManageMapper.selectByLessonName(lessonName);
    }
}
